package com.micro.school.order.entity;

import com.micro.school.order.domain.PayStudentFeePayment;
import com.micro.school.system.api.domain.StudentInfos;

import java.util.List;
import java.util.Map;

/**
 * 学生
 */
public class StudentEntity
{
    public static void setStudentStatus(List<PayStudentFeePayment> list, Map<Long, StudentInfos> studentInfosMap){
        if(null==list || list.isEmpty()){
            return;
        }
        if(null==studentInfosMap || studentInfosMap.isEmpty()){
            return;
        }
        for(PayStudentFeePayment payStudentFeePayment:list){
            Long id = payStudentFeePayment.getStudentId();
            if(null==id){
                continue;
            }
            StudentInfos studentInfos = studentInfosMap.get(id);
            if(null==studentInfos){
                continue;
            }
            payStudentFeePayment.setGraduate(getGraduate(studentInfos));
        }
    }
    public static String getGraduate(StudentInfos studentInfos){
        //0未入学1在校2休学3请假4退学5毕业
        Long graduate = studentInfos.getGraduate();
        if(null==graduate){
            return null;
        }
        if(graduate.intValue()==1){
            return "在校";
        }
        if(graduate.intValue()==2){
            return "休学";
        }
        if(graduate.intValue()==3){
            return "请假";
        }
        if(graduate.intValue()==4){
            return "退学";
        }
        if(graduate.intValue()==5){
            return "毕业";
        }
        return "新生";
    }
}
